<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<script type="text/javascript">
	function formReset(){
	document.getElementById("usuario").value="";
	document.getElementById("password").value="";
}
</script>

<h2>Login</h2>
	<p>
		<logic:notPresent name="usuarioVO">
			<html:form action="usuario.do" styleId="login" method="post">
				<label>Usuario:</label>
				<br>
				<html:text property="usrNick" styleClass="ui-widget-header" size="18" styleId="usuario"></html:text>
				<div>
					<script type="text/javascript">
						var f1 = new LiveValidation('usuario', {validMessage :" ", wait :25});
						f1.add(Validate.Presence, {	failureMessage :"Campo obligatorio" });
						f1.add(Validate.Length, {minimum :3});
					</script>
				</div>
				<label>Password:</label>
				<br>
				<html:password property="usrPassword" styleClass="ui-widget-header" size="18" styleId="password"></html:password>
				<div>
					<script type="text/javascript">
						var f1 = new LiveValidation('password', {validMessage :" ",wait :15});
						f1.add(Validate.Presence, {failureMessage :"Campo obligatorio"});
						f1.add(Validate.Length, {minimum :3	});
					</script>
				</div>
				<br>
				<center>
					<html:hidden property="accion" value="loginUsuario"/>
					<button style="width: 83px" type="submit" class="ui-state-active ui-corner-all">
						<span style="vertical-align:middle;"><img src="images/login.png" height="24"></span>
						<span style="vertical-align:middle; padding: 0 0 13px;">&nbsp;Entrar&nbsp;</span> 
					</button>
					&nbsp;&nbsp;
					<button style="width:95px" id="limpiar" class="ui-state-active ui-corner-all" onclick="formReset()">
						<span style="vertical-align:middle;"><img src="images/limpiar.png" height="24"></span>
						<span style="vertical-align:middle; padding: 0 0 13px;">&nbsp;Limpiar&nbsp;</span>								
					</button>
				</center><br>
			</html:form>
			
			<html:form action="crearU.do" styleId="login" method="post" styleClass="hform">
				<center>
					<button name="registro" class="ui-state-active ui-corner-all">
						<span style="vertical-align:middle;"><img align="bottom" src="images/registro.png" height="26"></span>
						<span style="vertical-align:middle; padding: 0 0 13px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registro&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> 
					</button>
				</center>
			</html:form>
			
		</logic:notPresent>
		
		<logic:present name="usuarioVO">
			 Bienvenido: &nbsp;&nbsp; 
			 <font size="4" color="#8AC800"> <bean:write name="usuarioVO" property="usrNick" /></font>
			 	<center>				 				 
				 	<html:form action="usuario.do" styleId="login" method="post" styleClass="hform">
				 		<html:hidden property="accion" value="cerrarSesion"/>
				 		<button type="submit" class="ui-state-active ui-corner-all">
							<span style="vertical-align:middle;"><img align="bottom" src="images/cerrar.png" height="24"></span>
							<span style="vertical-align:middle; padding: 0 0 13px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cerrar Sesion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> 
						</button>
				 	</html:form>
				</center>
			
	   </logic:present>
</p>
